/*
 * Queen.cpp
 *
 *  Created on: Mar 30, 2011
 *      Author: cnwilson
 */

#include "../inc/Queen.h"


Queen::Queen(Color _color,Position _pos): Piece(_color,_pos,QUEEN){

}

vector<Position> Queen::getPotentialMoves(){
	vector<Position> moves;
	Position quad1(1,1),quad2(-1,1),quad3(-1,-1),quad4(1,-1);

	//Diagonal
	Position temp(pos);
	while ((temp=temp+quad1)<BOARDSIZE)
		moves.push_back(temp);

	temp=pos;
	while ((temp=temp+quad2)>=0 && temp<BOARDSIZE)
		moves.push_back(temp);

	temp=pos;
	while ((temp=temp+quad3)>0)
		moves.push_back(temp);

	temp=pos;
	while ((temp=temp+quad4)>=0 && temp<BOARDSIZE)
		moves.push_back(temp);

	//Orthogonal
	Position col1(0,1),col2(0,-1),row1(-1,0),row2(1,0);

	temp= pos+col1;
	while (temp<BOARDSIZE)
	{
		moves.push_back(temp);
		temp+=col1;
	}

	temp=pos+col2;
	while (temp>0)
	{
		moves.push_back(temp);
		temp+=col1;
	}

	temp=pos+row1;
	while (temp>0)
	{
		moves.push_back(temp);
		temp+=row1;
	}

	temp=pos+row2;
	while (temp<BOARDSIZE)
	{
		moves.push_back(temp);
		temp+=row2;
	}

	return moves;
}
